<?php
/**
 * Created by swagger_zxd.
 * User: zxd
 * Date: 2017/11/24
 * Time: 11:26
 */

namespace App\Models\Test;


use Illuminate\Database\Eloquent\Model;

class Tag extends Model
{

    protected $table='tag';


    /**
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     * 第二个参数是关系对应表 第三个参数是本类的id，第四个参数是第一个参数那个类的id
     */
    public function belongsToManyArticle()
    {
        return $this->belongsToMany(Article::class,'article_tag','tag_id','article_id');
    }

}